home *** CD-ROM | disk | FTP | other *** search
-
-
- M A Z E 8 0
-
- Program and Text by John Murphy
-
-
- NOTE: You can run MAZE 80 from the LOADSTAR menu but it doesn't return to
- LOADSTAR.
-
- Maze 80 is a building block for anyone who would like to create their
- own maze programs using the 80-column screen on the C128. I developed Maze
- 80 while I was writing Maze Master 128. I needed to get the basic maze
- creation, display and movement working before I could do any of the fancy
- stuff, like making the maze hidden or invisible.
-
- There are two parts to the program, a machine language routine that
- creates the maze and the BASIC program that displays the maze and handles
- character movement. An integral part of the BASIC program is the Control
- 80-C toolkit. C80C provides the PEER and POST commands that are used to
- manipulate screen memory for the 80 column screen. It also has commands for
- moving data in and out of screen memory and color memory on the 80 column
- chip.
-
- The ML maze generator is an adaptation of an ML program for the C64
- that was published in Compute!'s Machine Language Routines for the
- Commodore 64. The routine was originally written by Gary E. Marsa for the
- PET and the VIC 20 as a machine language implementation of a maze
- generating routine created by Charles Bond in BASIC. The C64 translation
- was done by Gregg Peele for Compute! magazine. Source code for the ML
- routine is provided in EBUD format.
-
- The original ML routine created the maze in screen memory. My ML skills
- were not up to doing this on the 8563 chip, so I cheated. I modified the
- routine to create the maze in a section of memory that is set aside by the
- GRAPHIC command that is used to initialize the mouse version of Control 80-
- C. After the maze is complete I use the STORE and RECALL commands provided
- by C80C to move the maze into screen memory. Once that is done PEER and
- POST commands can be used to work with the maze in screen memory.
-
- You can change the character representing the wall with the following:
-
- POKE(DEC("2F24")),WL:POKE(DEC("2F79"),WL
-
- where WL is the screen code for the wall character. Use the same codes that
- you would use with the FILL command in C80C. You should do this before you
- call the ML routine to create the maze. You should also clear the 80 column
- screen and then STORE a copy of the screen with the following:
-
- STORE 2048,0,12288,0
-
- Use SYS 12032 to call the maze generator. The routine will generate the
- maze in memory starting at 12288. You can change the color of the walls
- with:
-
- FILL 2048,79,24,12
-
- This will change the color of the walls from the default foreground color
- to brown. You then need to move the maze from memory into the screen memory
- of the 80-column chip using:
-
- RECALL 2048,0,12288,0
-
- This will display the maze on the screen. If you want to have an exit from
- the maze you can POST a space in the upper left corner of the maze or
- wherever you choose.
-
- The rest of the program is pretty straight-forward BASIC code for
- reading the keyboard and the joystick, then moving the little ball
- character around the screen. There is also a routine at the end of the
- program for having the ball character appear to run around and solve the
- maze. This is taken from Charles Bond's original program.
-
- Hopefully, Maze 80 will give you the tools and the incentive to write
- your own maze games for the 80-column screen. And to share them with
- everyone else.
-
-
- FENDER'S POSTMUMBLE: To me, it's amazing that the logic to generate the
- maze is contained in 125 lines of ML code, and the logic to do the demo in
- 6 lines of BASIC code. I remember once writing an algorithm for moving a
- ball around on the screen and it was something like 20 lines long. And it
- didn't do anything as neat as find a way through a maze, remembering where
- it has gone.
-
- Off the top of my head it seems like the ML routine could be improved by
- having the size of the maze adjustable by the programmer who uses it. I'm
- putting the EBUD source code on the issue in case any Machine Language
- maven would like to make the generator more powerful.
-
- \\\\\ R - Run RETURN - Menu \\\\\
-
-